package com.xr.miniprogram.service.impl;

import java.util.Arrays;
import java.util.List;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.xr.miniprogram.mapper.MiniProgramStandardsSnapshotMapper;
import com.xr.miniprogram.domain.MiniProgramStandardsSnapshot;
import com.xr.miniprogram.service.IMiniProgramStandardsSnapshotService;

/**
 * 规格快照Service业务层处理
 * 
 * @author wls
 * @date 2023-12-05
 */
@Service
public class MiniProgramStandardsSnapshotServiceImpl implements IMiniProgramStandardsSnapshotService 
{
    @Autowired
    private MiniProgramStandardsSnapshotMapper miniProgramStandardsSnapshotMapper;

    /**
     * 查询规格
     * 
     * @param standardsSptId 规格主键
     * @return 规格
     */
    @Override
    public MiniProgramStandardsSnapshot queryById(Long standardsSptId)
    {
        return miniProgramStandardsSnapshotMapper.selectById(standardsSptId);
    }

    /**
     * 查询规格列表
     *
     * @return 规格
     */
    @Override
    public List<MiniProgramStandardsSnapshot> queryList()
    {
        return miniProgramStandardsSnapshotMapper.selectList(new QueryWrapper<>());
    }

    /**
     * 新增规格
     * 
     * @param miniProgramStandardsSnapshot 规格
     * @return 结果
     */
    @Override
    public int queryAdd(MiniProgramStandardsSnapshot miniProgramStandardsSnapshot)
    {
        return miniProgramStandardsSnapshotMapper.insert(miniProgramStandardsSnapshot);
    }

    /**
     * 修改规格
     * 
     * @param miniProgramStandardsSnapshot 规格
     * @return 结果
     */
    @Override
    public int queryUpdate(MiniProgramStandardsSnapshot miniProgramStandardsSnapshot)
    {
        return miniProgramStandardsSnapshotMapper.updateById(miniProgramStandardsSnapshot);
    }

    /**
     * 批量删除规格
     * 
     * @param standardsSptIds 需要删除的规格主键
     * @return 结果
     */
    @Override
    public int queryDeleteByIds(Long[] standardsSptIds)
    {
        return miniProgramStandardsSnapshotMapper.deleteBatchIds(Arrays.asList(standardsSptIds));
    }

    /**
     * 删除规格信息
     * 
     * @param standardsSptId 规格主键
     * @return 结果
     */
    @Override
    public int queryDeleteById(Long standardsSptId)
    {
        return miniProgramStandardsSnapshotMapper.deleteById(standardsSptId);
    }
}
